import logging

import pytest

from resource.pom.calculator import Calculator
from resource.pom.launcher import Launcher


class Test:
    app = Calculator

    @pytest.mark.parametrize('setup_teardown', [app.bundle_name], indirect=True)
    def test(self, setup_teardown, device):
        logging.info('步骤1：进入计算器应用')
        device.start_ability(self.app.bundle_name, self.app.ability_name)
        device.stop_permission()
        device.wait(1)
        device.click(*self.app.back_btn)
        device.wait(1)
        logging.info('预期结果1：可正常返回至桌面')
        device.assert_current_window(Launcher.entry_view)
